package entries;

public class Variable extends Entry{

	/** Level that the Entry was declared on */
	private int level;
	/** Value indicating if a variable has already been assigned a value */
	private boolean assigned;
	
	/**
	 * Create a new Variable
	 * @param type The type of the variable
	 * @param level The level on which the variable was declared
	 */
	public Variable(String type, int level) {
		this.kind = Entry.VARIABLE;
		this.level = level;
		this.type = type(type);
		this.assigned = false;
	}
	
	/** 
	 * Get the level of the Entry - Used by constants, variables and arguments
	 * @return this.level
	 */
	public int getLevel(){ return level; }

	/**
	 * A value has been assigned to the Variable
	 */
	public void assign(){ assigned = true; }

	/** 
	 * Return whether the variable has a value assigned to it or not
	 * @return assigned
	 */
	public boolean isAssigned() { return assigned; }
}